module.exports = function(app, settings){
	var debug 		= require('debug')('console')
		, express 	= require('express')
		, util 			= require('util')
		, url 			= require('url')
		, csrf 			= require('csurf') // ref: https://github.com/expressjs/csurf
		, cls 			= require('../../libs/continuationLocalStorage')
		, randomstring = require("randomstring")
		, csrfProtection = csrf({ cookie: true });

	var router 		= express.Router()
		, namespace = cls.getNamespace();

	router.route('/')
		.get(function(req, res, next){
			var userToken = res.locals.userToken; //User principal
			debug(" thread local : " + userToken);
			return res.render('user', { title: '用户',  userToken: userToken });
		});

	router.route('/add')
		.get(function(req, res, next){
			return res.render('user_add', { title: '新建用户' })
		})
		.post(function(req, res, next)
		{
			
		})
	app.use('/users', router);
}
